﻿<UserControl x:Class="SubtitleTools.Shell.JoinTwoFiles"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:vm="clr-namespace:SubtitleTools.Infrastructure.ViewModels;assembly=SubtitleTools.Infrastructure"
			 xmlns:b="clr-namespace:SubtitleTools.Common.Behaviors;assembly=SubtitleTools.Common"
			 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"              
			 mc:Ignorable="d" Name="ThisJoinTwoFiles" FontFamily="Tahoma"
			 d:DesignHeight="300" d:DesignWidth="300">
	<UserControl.Resources>
		<vm:JoinTwoFilesViewModel x:Key="vmJoinTwoFilesViewModel" />
	</UserControl.Resources>
	<Grid DataContext="{Binding Source={StaticResource vmJoinTwoFilesViewModel}}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<GroupBox Header="Second part" Margin="3" Grid.Row="0">
			<Grid Margin="3">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="auto" />
					<ColumnDefinition Width="*" />
					<ColumnDefinition Width="auto" />
				</Grid.ColumnDefinitions>
				<TextBlock VerticalAlignment="Center" Margin="3" Text="Subtitle file:" Grid.Column="0" />
				<TextBox Text="{Binding JoinTwoFilesGuiData.SubtitlePath, Mode=TwoWay}"                                 
							 Grid.Column="1" Margin="3" IsReadOnly="True" />
				<Button Content="..." Margin="3" 
								Command="{Binding DoSelectFile}"
								CommandParameter="{Binding ElementName=ThisJoinTwoFiles, Path=FirstFilePath}"
								Width="30" Height="25" Grid.Column="2" >
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="Click">
							<b:OpenFileDialogBoxBehavior 
									DialogFilterType="Subtitle"
									FileDialogDialogResultCommand="{Binding JoinTwoFilesGuiData.SubtitlePath, Mode=TwoWay}"/>
						</i:EventTrigger>
					</i:Interaction.Triggers>
				</Button>
			</Grid>
		</GroupBox>
		<GroupBox Margin="3" Header="Start 2nd part from" Grid.Row="1">
			<Grid Margin="3">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="*" />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
				</Grid.RowDefinitions>

				<TextBlock Grid.Row="0" Grid.Column="0" Text="Hours" Margin="3" />
				<TextBox Grid.Row="1" Grid.Column="0"
								 Text="{Binding JoinTwoFilesGuiData.Hour}"
								 Margin="3" Width="40" />

				<TextBlock Grid.Row="0" Text="Minutes" Grid.Column="1" Margin="3"/>
				<TextBox Grid.Column="1" Grid.Row="1" 
								 Text="{Binding JoinTwoFilesGuiData.Minutes}"
								 Margin="3" Width="40" />

				<TextBlock Grid.Row="0" Text="Seconds" Grid.Column="2" Margin="3"/>
				<TextBox Grid.Column="2" Grid.Row="1" Name="txtSeconds"
								 Text="{Binding JoinTwoFilesGuiData.Seconds}"
								 Margin="3" Width="40" />

				<TextBlock Grid.Row="0" Text="Ms." Grid.Column="3" Margin="3"/>
				<TextBox Grid.Column="3" Grid.Row="1" 
								 Text="{Binding JoinTwoFilesGuiData.Milliseconds}"
								 Margin="3" Width="40" HorizontalAlignment="Left" />
			</Grid>
		</GroupBox>
		<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="2">
			<Button Content="Join" Width="60"  
				Command="{Binding DoJoin}"
				CommandParameter="{Binding ElementName=ThisJoinTwoFiles, Path=FirstFilePath}"
				Margin="3" Height="25" />
			<Button Content="Cancel" Margin="3" 
					Command="{Binding DoCloseJoinPopup}"
					Width="60" />
		</StackPanel>
	</Grid>
</UserControl>
